
<template>
    <div class="model-form">
        <el-page-header @back="goBack" content="更新">
        </el-page-header>
        <div class="model-content">
            <el-form ref="ruleForm" :rules="rules" :model="form" label-width="160px">
                <el-row :gutter="10">
    <el-col :span="12">
            <el-form-item label="姓名"  prop="customer">
        <el-input v-model="form.customer" name="customer">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="类型"  prop="orderType">
        <el-input v-model="form.orderType" name="orderType">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="重量"  prop="weight">
        <el-input v-model="form.weight" name="weight">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="数量"  prop="num">
        <el-input v-model="form.num" name="num">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="原价"  prop="totalAmount">
        <el-input v-model="form.totalAmount" name="totalAmount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="应付金额"  prop="amount">
        <el-input v-model="form.amount" name="amount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="运费"  prop="freight">
        <el-input v-model="form.freight" name="freight">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="餐盒费"  prop="mealFee">
        <el-input v-model="form.mealFee" name="mealFee">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="整单折扣"  prop="changeAmount">
        <el-input v-model="form.changeAmount" name="changeAmount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="实际支付金额"  prop="payAmount">
        <el-input v-model="form.payAmount" name="payAmount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="卖家优惠券总金额"  prop="discount">
        <el-input v-model="form.discount" name="discount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="平台优惠券总金额"  prop="platformDiscount">
        <el-input v-model="form.platformDiscount" name="platformDiscount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="积分抵扣"  prop="integralDiscount">
        <el-input v-model="form.integralDiscount" name="integralDiscount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="使用积分数"  prop="useIntegral">
        <el-input v-model="form.useIntegral" name="useIntegral">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="使用红包"  prop="useRedPacket">
        <el-input v-model="form.useRedPacket" name="useRedPacket">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="满减金额"  prop="reduceMoney">
        <el-input v-model="form.reduceMoney" name="reduceMoney">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="单件商品红包抵扣"  prop="redPacketDiscount">
        <el-input v-model="form.redPacketDiscount" name="redPacketDiscount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="退款金额"  prop="returnAmount">
        <el-input v-model="form.returnAmount" name="returnAmount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="积分赠送"  prop="sendIntegral">
        <el-input v-model="form.sendIntegral" name="sendIntegral">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="系统自动收货时间"  prop="sysReceiveTime">
        <el-input v-model="form.sysReceiveTime" name="sysReceiveTime">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="是否已延长收货"  prop="hasExtendReceive">
        <el-input v-model="form.hasExtendReceive" name="hasExtendReceive">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="商家改价格时间"  prop="editPriceTime">
        <el-input v-model="form.editPriceTime" name="editPriceTime">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="完成时间"  prop="finishTime">
        <el-input v-model="form.finishTime" name="finishTime">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="购买数量"  prop="productCount">
        <el-input v-model="form.productCount" name="productCount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="退货数量"  prop="returnCount">
        <el-input v-model="form.returnCount" name="returnCount">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="最后提现时间"  prop="remindTime">
        <el-input v-model="form.remindTime" name="remindTime">
        </el-input>
            </el-form-item>

    </el-col>
    <el-col :span="12">
            <el-form-item label="支付状态"  prop="payState">
        <nb-select catalog="payState" v-model="form.payState"></nb-select>
            </el-form-item>

    </el-col>

                    <el-col :span="22">
                        <el-form-item>
                            <el-button @click="goBack">取消</el-button>
                            <el-button type="primary" @click="updateData">确定</el-button>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
        </div>
    </div>
</template>

<script>
    import common from "@/mixins/common.js";

    import nbSelect from "@/components/nbSelect.vue";

    export default {
        name: "orderInfo_update",
        mixins: [common],
        components: {
            nbSelect
        },
        data() {
            return {
                form: {
                    customer: '',
                    orderType: '',
                    weight: '',
                    num: '',
                    totalAmount: '',
                    amount: '',
                    freight: '',
                    mealFee: '',
                    changeAmount: '',
                    payAmount: '',
                    discount: '',
                    platformDiscount: '',
                    integralDiscount: '',
                    useIntegral: '',
                    useRedPacket: '',
                    reduceMoney: '',
                    redPacketDiscount: '',
                    returnAmount: '',
                    sendIntegral: '',
                    sysReceiveTime: '',
                    hasExtendReceive: '',
                    editPriceTime: '',
                    finishTime: '',
                    productCount: '',
                    returnCount: '',
                    remindTime: '',
                    payState: ''                },
                rules: {
                }
            }
        },
        async mounted() {
            let id = this.$route.query.id;
            let data = {};
            data.id = id;
            let res = await this.$http.form("/orderInfo/view", data);
            if (res.code === 200) {
                this.form = res.data;
            }
        },
        methods: {
            async updateData() {
                try {
                    let valid = await this.$refs["ruleForm"].validate();
                    if (!valid) {
                        return;
                    }
                } catch (e) {
                    return;
                }
                await this.updateDataPost();
            },
            async updateDataPost() {
                let res = await this.$http.form("/orderInfo/update", this.form);
                if (res.code !== 200) {
                    this.$message.error(res.msg);
                    return
                }
                this.$message({
                    message: '更新数据成功',
                    type: 'success'
                });
                this.$router.go(-1);
            },

        }
    }


</script>

<style scoped>

</style>